﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class downloadProgress : MonoBehaviour {

	public Text txtProgress = null;
	public Text txtIndex = null;

	public float progress = 0;
	public int nowIdx = 1;
	public int totalIdx = 1;

	private static downloadProgress instance = null;
	public static downloadProgress GetInstance ()
	{
		return instance;
	}

	public static void Show( float progress, int now, int total)
	{
		instance.progress = progress;
		instance.nowIdx = now;
		instance.totalIdx = total;

		instance.gameObject.SetActive (true);


	}

	public static void Hide()
	{
		instance.gameObject.SetActive (false);
	}

	// Use this for initialization
	void Awake () {
		instance = this;
	}
	
	// Update is called once per frame
	void Update () {
		txtProgress.text = string.Format("{0:P}", progress);

		txtIndex.text = nowIdx + "/" + totalIdx;
	}



}
